﻿using System.Data.Entity.ModelConfiguration;

namespace InvestmentIntelligence.DbModel.Models.Mapping
{
    internal class InvestmentSecurityUnderlyingSerieMap : EntityTypeConfiguration<InvestmentSecurityUnderlyingSerie>
    {
        public InvestmentSecurityUnderlyingSerieMap()
        {
            // Primary Key
            this.HasKey(t => new { t.InvestmentId, t.UnderlyingSecurityId, t.Date });

            // Table & Column Mappings
            this.ToTable("InvestmentSecurityUnderlyingSerie", "Analytics");
            this.Property(t => t.InvestmentId).HasColumnName("InvestmentId");
            this.Property(t => t.UnderlyingSecurityId).HasColumnName("UnderlyingSecurityId");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.StockReturn).HasColumnName("StockReturn").HasPrecision(18, 4);
            this.Property(t => t.NormalizationCoeficient).HasColumnName("NormalizationCoeficient").HasPrecision(18, 4);
            this.Property(t => t.Net).HasColumnName("Net").HasPrecision(29, 20);
            this.Property(t => t.Gross).HasColumnName("Gross").HasPrecision(29, 20);
        }
    }
}
